import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
const config = {
    routes: [
        {
            path: '/',
            redirect: '/welcome'
        },
        {
            name: 'welcome',
            path: '/welcome',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            children: [
                {
                    path: '/',
                    component: resolve => require(['../components/page/Welcome.vue'], resolve)
                },
                {
                    name: 'taskList',
                    path: '/taskList',
                    component: resolve => require(['../components/page/Task/TaskList.vue'], resolve)
                },
                {
                    name: 'taskAdd',
                    path: '/taskAdd',
                    component: resolve => require(['../components/page/Task/TaskAdd.vue'], resolve)
                },
                {
                    name: 'reportInit',
                    path: '/reportInit',
                    component: resolve => require(['../components/page/Task/ReportInit.vue'], resolve)
                },
                {
                    name: 'taskDetail',
                    path: '/taskDetail',
                    component: resolve => require(['../components/page/Task/taskDetail.vue'], resolve)
                },
            ]
        },
        {
            name: 'login',
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
    ]
}
const router = new Router(config);
/*router.beforeEach((to, from, next) => {
 if (from.path == to.path && from.fullPath != to.fullPath) {
 window.location.reload();
 } else {
 next();
 }
 })*/
export default router
